

$.extend({		
		bAjax : function(settings) {
			var async = true;
			if(settings.async){
				async = settings.async;
			}
			var dataParam ={};
			if(settings.data){
				$.extend(dataParam,settings.data);
			}
			 
			$.ajax({
			  url: settings.url,
			  dataType : 'json',
			  async : async,
			  data:dataParam,
			  type : "POST",
			  beforeSend: function ( xhr ) {
				  if(settings.id){
					  $("<div class=\"datagrid-mask\" style=\"display:block\"></div>").appendTo($("#"+settings.id));
					  var msg=$("<div class=\"datagrid-mask-msg\" style=\"display:block;left:50%\"></div>").html("数据加载中，请稍后……").appendTo($("#"+settings.id));
					  msg.css("marginLeft",-msg.outerWidth()/2);
				  }else{
					  $("<div class=\"datagrid-mask\" style=\"display:block\"></div>").appendTo($("body"));
					  var msg=$("<div class=\"datagrid-mask-msg\" style=\"display:block;left:50%\"></div>").html("数据加载中，请稍后……").appendTo($("body"));
					  msg.css("marginLeft",-msg.outerWidth()/2);
				  }
				  
			    //$.showAjaxImg("ajaxImg");
			  },
			  success:function(data){
				  //$.hideAjaxImg("ajaxImg");
				  if(settings.id){
					  $("#"+settings.id).children("div.datagrid-mask-msg").remove();
					  $("#"+settings.id).children("div.datagrid-mask").remove();
				  }else{
					  $("body").children("div.datagrid-mask-msg").remove();
					  $("body").children("div.datagrid-mask").remove();
			  	  }
				  //setTimeout(function(){},1000);
				  if(settings.success){
					  settings.success(data);
				  }
			  },
			  error : function(XMLHttpRequest, textStatus, errorThrown) {
				  $("body").children("div.datagrid-mask-msg").remove();
				  $("body").children("div.datagrid-mask").remove();
				  if(settings.error){
					  settings.error(XMLHttpRequest, textStatus, errorThrown);
				  }
		   	  }
			  
			});
		}
	});